<template>
	<view class="details_first">
		<view class="banner">
			<u-swiper :list="list" height='750' border-radius='0' mode='number' indicator-pos='bottomRight'></u-swiper>
		</view>
		<!--  -->
		<view class="info">
			<view class="title">{{goods_name}}</view>
			<view class="stock">{{pay_money}}件</view>
			<view class="money">
				<text class="m_left">￥{{wyy}}</text>
				<text class="m_right">赠{{zhangfu}}%</text>
			</view>
			<view class="price">
				总价：<text class="tip">￥</text><text class="num">{{pay_money}}</text>
			</view>
		</view>
		<!--  -->
		<view class="content">
			<view class="text" v-html="goods_details_content"></view>
		</view>
		<!-- 底部 -->
		<BottomBtn title='立即购买' @submit='submitBtn'></BottomBtn>
	</view>
</template>

<script>
	import BottomBtn from '@/components/bottom_btn/bottom_btn.vue';
	export default {
		components:{
			BottomBtn
		},
		data() {
			return {
				id:'',
				goods_image:'',
				list:[],
				goods_name:"",
				pay_money:"",
				wyy:'',
				zhangfu:'',
				goods_details_content:'',
			};
		},
		onLoad(opt) {
			this.id=opt.id
			this.goodsInfo()
		},
		methods:{
			// 获取商品信息
			goodsInfo(){
				var that = this
				that.$tips.showLoading('加载中')
				var params = {
					order_id:that.id
				}
				that.$httpApi.purGoodsInfo(params).then((res)=>{
					that.$tips.hideLoading()
					if(res.code==1){
						that.goods_image=res.data.goods_image
						that.list=res.data.goods_smallimages
						that.goods_name=res.data.goods_name
						that.pay_money=res.data.pay_money
						that.wyy=res.data.wyy
						that.zhangfu=res.data.zhangfu
						that.goods_details_content=res.data.goods_details_content
					}
				})
			},
			// 立即购买
			submitBtn(){
				var obj = {
					id:this.id,
					img:this.goods_image,
					name:this.goods_name,
					pay_money:this.pay_money,
					wyy:this.wyy,
					zhangfu:this.zhangfu,
				}
				uni.navigateTo({
					url:'/pages/mall/order_first?info=' + JSON.stringify(obj)
				})
			},
		}
	}
</script>

<style lang="less">
	.details_first{
		width: 100%;
		.banner{
			width: 100%;
			height: 750rpx;
		}
		.info{
			width: 100%;
			padding: 30rpx 32rpx;
			background: #fff;
			.title{
				width: 100%;
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #222222;
				line-height: 48rpx;
			}
			.stock{
				width: 100%;
				padding-top: 12rpx;
				font-size: 24rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #999999;
				line-height: 32rpx;
			}
			.money{
				width: 100%;
				padding-top: 12rpx;
				display: flex;
				align-items: center;
				.m_left{
					font-size: 28rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #222222;
				}
				.m_right{
					padding-left: 32rpx;
					font-size: 28rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #26C281;
				}
			}
			.price{
				width: 100%;
				padding-top: 25rpx;
				display: flex;
				align-items: center;
				font-size: 28rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #222222;
				.tip{
					font-size: 24rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #FF6230;
				}
				.num{
					font-size: 40rpx;
					font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #FF6230;
					margin-top: -8rpx;
				}
			}
		}
		.content{
			margin-top: 24rpx;
			margin-bottom: 24rpx;
			width: 100%;
			background: #fff;
			.text{
				width: 100%;
				::v-deep p{
					width: 100%;
					image{
						display: block;
						width: 100% !important;
					}
					img{
						display: block;
						width: 100% !important;
					}
				}
			}
		}
	}
</style>
